DELETE FROM x25_tmp
WHERE (x25_tmp.accumulated_calls <= 0) AND (x25_tmp.rx_bytes <= 0) AND (x25_tmp.tx_bytes <= 0) AND (x25_tmp.total_rx_frames <= 0) AND (x25_tmp.total_tx_frames <= 0)
GO
INSERT INTO x25
  (x25.node, x25.lid, x25.dbegin, x25.tod, x25.gbl_tic, x25.total_rx_frames, x25.total_tx_frames, x25.accumulated_calls, x25.rx_bytes, x25.tx_bytes, x25.error)
SELECT
  x25_tmp.node, x25_tmp.lid, DATEADD(yy, 16, CONVERT(smalldatetime, x25_tmp.dbegin, 12)) AS Expr1, x25_tmp.tod, x25_tmp.gbl_tic, x25_tmp.total_rx_frames,
 x25_tmp.total_tx_frames, x25_tmp.accumulated_calls, x25_tmp.rx_bytes, x25_tmp.tx_bytes, x25_tmp.error
FROM x25_tmp